package listnode;

public class 反转链表206 {

    //1.0双指针
    public ListNode reverseList(ListNode head) {
        ListNode temp = null;
        ListNode pre = null;
        ListNode cur = head;

        while (cur != null) {
            // 先保存cur下一个节点
            temp = cur.next;
            //
            cur.next = pre;
            pre = cur;
            cur = temp;

        }
        return pre;
    }

}
